<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Document</title>
        <style>
            p{
                background-color: lightgreen;
                width:200px;
                font-size: 36px;
                line-height: 36px;
                text-align: center;
            }
        </style>
    </head>
    <body>
        <div id="app">
            <button @click="toggle">toggle</button>
            <transition
            @before-enter="beforeEnter"
            @enter="enter"
            @after-enter="afterEnter"
            @before-leave="beforeLeave"
            @leave="leave"
            @after-leave="afterLeave"
            >
                <p v-if="show">Hello</p>
            </transition>
        </div>
        <script src="vue.js"></script>
        <script>
        var vm = new Vue({
            el:'#app',
            data:{show:true},
            methods:{
                toggle(){
                    this.show = !this.show;
                },
                beforeEnter(){
                    console.log('beforeEnter')
                },
                enter(){
                    console.log('enter')
                },
                afterEnter(){
                    console.log('afterEnter')
                },
                beforeLeave(){
                    console.log('beforeLeave')
                },
                leave(){
                    console.log('leave')
                },
                afterLeave(){
                    console.log('afterLeave')
                }
            }
        });
    </script>
    </body>
</html>